import hilfsklassen.In;


public class MonteCalro {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		int n = In.readInt("Anzahl der Versuche: ");
		System.out.println();
		System.out.println("PI nach "+n+" Versuchen = "+calcPI(n)+" - PI: "+Math.PI);
		
		

	}

	public static double calcPI(int n) {
		double ret;
		int count=0;
		for(int i=1;i<=n;i++){
			double x, y;
			x = Math.random();
			y = Math.random();
			double dist = x*x + y*y;
			if(dist <=1) {
				count++;
			}
		}
		ret = 4.0*(count/(double)n);
		return ret;
	}
}
